package org.nepu.scr.indexrate.converter.riskrate.equipmentrisk;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.riskrate.equipmentrisk.LifeB22d;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class LifeB22dConverter implements AttributeConverter<LifeB22d, String> {
    @Override
    public String convertToDatabaseColumn(LifeB22d lifeB22d) {
        return JSONUtil.toJsonStr(lifeB22d);
    }

    @Override
    public LifeB22d convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, LifeB22d.class);
    }
}
